<%@ page import="com.aiwei.tdjk.enums.SaleOrderStatusEnum" %>
<%@ page import="com.aiwei.tdjk.entity.CustomsHandbookUsedDetail" %>
<%@ page import="com.aiwei.tdjk.enums.CustomsHandbookUsedDetailStatusEnum" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/template/common/taglibs.jspf" %>
<es:contentHeader/>


<t:base type="jquery,jquery-ui-bootstrap:bootstrap,jquery-ui-bootstrap:jquery-ui,query-ui-bootstrap:jquery.layout,jquery-ui-bootstrap:font-awesome"></t:base>
<t:base type="jquery-ui-bootstrap:jquery.blockUI,jquery-ui-bootstrap:bootstrap.file-input,bootstrap-datetimepicker,jQuery-Validation-Engine,nicescroll,application"></t:base>


<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/box.css"/>



<div class="box border purple" style="">
    <div class="box-title">
        <h4><i class="fa fa-bars"></i>海关手册使用详情列表</h4>
        <div class="tools">
            <a href="#box-config" data-toggle="modal" class="config">
                <i class="fa fa-cog"></i>
            </a>
            <a href="javascript:;" class="reload">
                <i class="fa fa-refresh"></i>
            </a>
            <a href="javascript:;" class="collapse">
                <i class="fa fa-chevron-up"></i>
            </a>
            <a href="javascript:;" class="remove">
                <i class="fa fa-times"></i>
            </a>
        </div>
    </div>

    <div class="box-body" style="display: block;">

        <div data-table="table" class="panel">

            <es:showMessage/>


            <div class="row-fluid tool ui-toolbar">


                <div class="span3">
                    <div class="btn-group">
                        <a class="btn no-disabled" href="javascript:history.back();">
                            <span class="icon-file-alt"></span>
                            返回
                        </a>
                    </div>
                </div>

                <div class="span9">
                    <%--<%@include file="searchForm.jsp" %>--%>
                </div>
            </div>

            <table id="table" class="sort-table table table-bordered table-hover datatable_single table-striped"
                   data-prefix-url="<%=request.getContextPath()%>/admin/customsHandbookProductdetail">
                <thead>
                <tr>

                    <th>创建日期</th>
                    <th>发货单主键</th>
                    <th>手册项目主键</th>
                    <th>使用量</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${usedDetailList}" var="m">
                    <tr>
                        <td><fmt:formatDate value="${m.createDate}" pattern='yyyy年MM月dd日 hh:mm:ss'/></td>
                        <td>${m.deliveryId}</td>
                        <td>${m.customsHandbookProductdetailId}</td>
                        <td>${m.usedQty}</td>
                        <td>

                            <c:set var="status" scope="request" value="${m.status }"/>
                            <%=CustomsHandbookUsedDetailStatusEnum.getValue(Integer.parseInt(request.getAttribute("status").toString())).getInfo()%>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>

    </div>
</div>


<es:contentFooter/>
<%@include file="/WEB-INF/template/common/admin/import-sys-js.jspf" %>
<script type="text/javascript">
    $(function () {

        $(".btn-create").click(function() {
            var url = ctx + "/admin/customsHandbookProductdetail/create?customsHandBookId=" +${customsHandbookProductdetail.customsHandBookId};
            window.location.href =url;
        });



        $(".rentShip").click(function() {
            var checkbox = $.table.getAllSelectedCheckbox($(".table"));
            if(!checkbox.length) return;
            if(checkbox.size() >1) {
                $.app.alert({
                    message : "只能选中一条记录！",
                })
                return;
            }

            var last = $("tr.active").first().children("td").last();
            console.log(last.html().trim())
            if (last.html().trim()=="已订舱"){
                $.app.alert({
                    message : "不能够重复订舱！",
                })
                return;
            }
            var id = checkbox.val();
            var url = ctx + "/admin/bookingContainer/create?" + checkbox.serialize();
            window.location.href =url;
        });
    });
</script>

